<!--
 * @Author: liwei 474083297@qq.com
 * @Date: 2024-05-07 19:42:58
 * @LastEditors: liwei 474083297@qq.com
 * @LastEditTime: 2024-05-21 09:54:56
 * @FilePath: /app/src/home.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
	<div class="orgHome">
		<left-tree ref="leftTree" class="tree" @userData="userData"></left-tree>
		<rigth-table
			class="rigth-table"
			:users="users"
			@refreshAuthListWithCode="refreshAuthListWithCode"
		></rigth-table>
	</div>
</template>

<script>
import leftTree from './components/leftTree.vue';
import RigthTable from './components/rigthTable.vue';
import { EventBus } from '@/event-bus';
export default {
	components: { leftTree, RigthTable },
	name: 'AppOrgHome',

	data() {
		return {
			users: []
		};
	},

	mounted() {
		EventBus.$on('notification', message => {
			if (message === 'userLogined') {
				this.users = [];
			}
		});
	},

	methods: {
		userData(users) {
			console.log('users--', users);
			this.users = users || [];
		},
		refreshAuthListWithCode(code) {
			this.$refs.leftTree.refreshAuthListWithCode(code);
		}
	}
};
</script>

<style lang="scss" scoped>
.orgHome {
	padding: 0;
	margin: 0;
	// background-color: rebeccapurple;
	display: flex;
	flex-direction: row;
	height: 100%;

	.tree {
		height: calc(100vh - 70px);
		width: 300px;
	}
	.rigth-table {
		width: calc(100vw - 300px);
		height: calc(100vh - 70px);
	}
}
</style>
